#include "Color.h"
#include <cstdlib>
#include <cmath>

Color::Color(unsigned waveLength)
{
    if (waveLength > 400 && waveLength < 550) {
        blue = 255 * (75 - abs(475 - waveLength)) / 75;
    }
    else {
        blue = 0;
    }
    
    if (waveLength > 500 && waveLength < 650) {
        green = 255 * (75 - abs(575 - waveLength)) / 75;
    }
    else {
        green = 0;
    }
    
    if (waveLength > 600 && waveLength < 800) {
        red = 255 * (100 - abs(700 - waveLength)) / 100;
    }
    else {
        red = 0;
    }
}
